<template>
    <button @click="goback">后退</button>
    <div>
        <h1>用户详情</h1>
        <p>用户ID: {{id}}</p>
    </div>
</template>

<script setup>
import {useRouter} from 'vue-router'
const props = defineProps({
    id:String
}) 
const router = useRouter()
const goback = () => {
    // router.go(-1)
    router.back()
}
</script>
<style scoped>
 button{
  background-color: #409eff;
  color: #fff;
 }
</style>